package a.f.h.f.a;

import a.c.ab;
import a.c.q;
import a.c.w;
import a.c.x;
import a.f.j.*;
import a.f.j.o;
import a.i.mb;
import a.i.t;

public class b
  implements k
{
  private cb a;
  private e b = null;
  private a.c.n c = null;
  private a.c.n d = null;
  private a.c.n e = null;
  private a.c.n f = null;
  private x h = null;
  private a.c.n i = null;
  private boolean j = false;
  private boolean k = false;
  private int l = -1;
  private int m = 50;
  private mb n = new mb();
  private int o = 0;
  private int q = 0;
  private int r = 0;
  private int s = 0;
  private int t = 0;
  private boolean u = false;
  public static boolean v;
  
  public void a(cb paramcb)
  {
    this.a = paramcb;
  }
  
  public void a(boolean paramBoolean)
  {
    this.k = paramBoolean;
  }
  
  public void a(int paramInt)
  {
    this.l = paramInt;
  }
  
  public int c()
  {
    return this.l;
  }
  
  public void c(boolean paramBoolean)
  {
    this.j = paramBoolean;
  }
  
  public boolean d()
  {
    return this.j;
  }
  
  public int e()
  {
    return this.m;
  }
  
  public void c(int paramInt)
  {
    this.m = paramInt;
  }
  
  public void a(e parame)
  {
    this.b = parame;
  }
  
  public void a(a.c.n paramn)
  {
    this.d = paramn;
  }
  
  public void a(x paramx)
  {
    this.h = paramx;
  }
  
  public void b(a.c.n paramn)
  {
    this.c = paramn;
  }
  
  public void d(a.c.n paramn)
  {
    this.f = paramn;
  }
  
  public void e(a.c.n paramn)
  {
    this.e = paramn;
  }
  
  public void f(a.c.n paramn)
  {
    this.i = paramn;
  }
  
  public int f()
  {
    return this.o;
  }
  
  public int g()
  {
    return this.q;
  }
  
  public int h()
  {
    return this.r;
  }
  
  public int i()
  {
    return this.s;
  }
  
  public int j()
  {
    return this.t;
  }
  
  public void a()
  {
    int i1 = e.i;
    boolean bool = e.h;
    m();
    if (i1 == 0)
    {
      if (this.a == null) {
        throw new RuntimeException("Forgot to set PlanarInformation!");
      }
      this.b.a(this.a);
    }
    a.c.n localn = this.a.a().C();
    a.c.k localk = this.b.c();
    y localy = new y(this.a);
    localy.a();
    ab localab1 = new ab();
    Object localObject1 = this.a.a().w();
    do
    {
      if (!((a.c.m)localObject1).e()) {
        break;
      }
      localObject2 = ((a.c.m)localObject1).a();
      if (bool) {
        break label174;
      }
      if (this.b.a((a.c.d)localObject2) == 0) {
        localab1.add(localObject2);
      }
      ((a.c.m)localObject1).f();
    } while (!bool);
    if (i1 == 0)
    {
      if (this.a.a().m() == 0) {
        label174:
        localy.b();
      }
    }
    else
    {
      this.a.a(this.a.b().a());
      return;
    }
    localObject1 = new j(this.a.a(), localk, this.d);
    ((j)localObject1).a();
    this.n.g();
    Object localObject2 = new m();
    ((m)localObject2).a(this.j);
    ((m)localObject2).a(this.m);
    ((g)localObject2).a(this.b);
    ((g)localObject2).a(this.d);
    ((g)localObject2).a(this.a);
    this.o = ((int)this.n.d());
    a(true, true);
    ab localab2 = new ab();
    ab localab3 = new ab();
    Object localObject3 = ((g)localObject2).b().l();
    label419:
    do
    {
      if (!((a.c.m)localObject3).e()) {
        break;
      }
      localObject4 = ((a.c.m)localObject3).a();
      if ((i1 == 0) && (bool)) {
        break label454;
      }
      if (i1 == 0) {
        if (localk.getInt(localObject4) == 0)
        {
          localab2.add(localObject4);
          if (i1 != 0) {
            continue;
          }
          if (!bool) {
            break label419;
          }
        }
      }
      localab3.add(localObject4);
      ((a.c.m)localObject3).f();
    } while (!bool);
    ((j)localObject1).a(this.a, localab2, localab3);
    if (i1 == 0) {
      ((j)localObject1).c();
    }
    label454:
    localObject3 = new h(this.h, this.b, this.c);
    ((h)localObject3).a(this.a);
    Object localObject4 = ((g)localObject2).a();
    Object localObject5 = ((ab)localObject4).l();
    do
    {
      while (!bool)
      {
        if (!((a.c.m)localObject5).e()) {
          break;
        }
        localn.a(((a.c.m)localObject5).a(), true);
        localn.a(this.a.b(((a.c.m)localObject5).a()), true);
        ((a.c.m)localObject5).f();
      }
    } while (i1 != 0);
    localObject5 = new a(this.a, this.d, this.f, localn, this.c, this.i);
    this.a.a((db)localObject5);
    a.c.e locale1 = ((g)localObject2).d();
    a.c.e locale2 = ((g)localObject2).e();
    this.n.g();
    d locald = new d(this.a, this.b, locale2, locale1);
    locald.a(this.d);
    locald.c(this.e);
    this.s = localab3.size();
    if (!localab3.isEmpty()) {}
    do
    {
      localObject6 = (a.c.d)localab3.b();
      locald.a((a.c.d)localObject6, localab3, (ab)localObject4);
      a(true, true);
      if ((i1 == 0) && (bool)) {
        break label767;
      }
      if (!bool) {
        break;
      }
      a(this.b, localn, locale2, locale1);
      localy.b();
      a(((g)localObject2).c());
    } while (i1 != 0);
    ((h)localObject3).b(this.a);
    label767:
    Object localObject6 = new z(this.a);
    a_ locala_ = new a_(localn);
    ((z)localObject6).a(locala_);
    ((z)localObject6).a(localab2);
    a(false, false);
    this.t = localab2.size();
    this.q = ((int)this.n.d());
    this.n.g();
    if (i1 == 0)
    {
      if (this.k) {
        ((z)localObject6).a(this.l, localab1);
      }
      this.r = ((int)this.n.d());
      this.a.e();
      a((ab)localObject4, localn);
      this.a.a().a(localn);
    }
    this.a.b((db)localObject5);
  }
  
  public void a(e parame, a.c.n paramn, a.c.e parame1, a.c.e parame2)
  {
    int i3 = e.i;
    boolean bool = e.h;
    q localq = this.a.a();
    Object localObject1 = localq.v();
    Object localObject2;
    label138:
    label167:
    label174:
    label227:
    label636:
    do
    {
      if (!((w)localObject1).e()) {
        break;
      }
      localObject2 = ((w)localObject1).d();
      if ((i3 != 0) || ((!parame1.equals(localObject2)) && ((i3 != 0) || (!parame2.equals(localObject2)))))
      {
        localObject3 = ((a.c.e)localObject2).n();
        if (((a.c.m)localObject3).e()) {}
        while (i3 != 0)
        {
          if (bool) {
            break label138;
          }
          if (parame.a(((a.c.m)localObject3).a()) == 0)
          {
            ((a.c.m)localObject3).b();
            if (!bool) {
              break;
            }
          }
        }
        int i1 = parame.a(((a.c.m)localObject3).a());
        if (i3 == 0) {
          if (i1 == 2)
          {
            i2 = 1;
            if (i3 != 0) {
              break label174;
            }
            if (!bool) {
              break label167;
            }
          }
        }
        int i2 = 2;
        do
        {
          do
          {
            if (!((a.c.m)localObject3).e()) {
              break;
            }
            if (bool) {
              break label227;
            }
            if (parame.a(((a.c.m)localObject3).a()) == i2) {
              break;
            }
            ((a.c.m)localObject3).b();
          } while (!bool);
        } while (i3 != 0);
        if (parame.a(((a.c.m)localObject3).a()) == 2)
        {
          parame.a(((w)localObject1).d(), ((a.c.m)localObject3).a());
          if (i3 != 0) {
            break label283;
          }
          if (!bool) {}
        }
        else
        {
          parame.c(((w)localObject1).d(), ((a.c.m)localObject3).a());
        }
        do
        {
          do
          {
            if (!((a.c.m)localObject3).e()) {
              break;
            }
            if (bool) {
              break label336;
            }
            if (parame.a(((a.c.m)localObject3).a()) == i1) {
              break;
            }
            ((a.c.m)localObject3).b();
          } while (!bool);
        } while (i3 != 0);
        if (parame.a(((a.c.m)localObject3).a()) == 2)
        {
          if (i3 != 0) {
            break label391;
          }
          parame.a(((w)localObject1).d(), ((a.c.m)localObject3).a());
          if (!bool) {}
        }
        else
        {
          parame.c(((w)localObject1).d(), ((a.c.m)localObject3).a());
        }
      }
      Object localObject3 = this.b.b((a.c.e)localObject2);
      Object localObject5;
      if (i3 == 0) {
        if (localObject3 != null)
        {
          this.b.c((a.c.e)localObject2, null);
          localObject4 = ((a.c.e)localObject2).b((a.c.d)localObject3);
          do
          {
            localObject5 = ((a.c.m)localObject4).a();
            if (this.b.a((a.c.d)localObject5) != 1) {
              break;
            }
            if (i3 == 0)
            {
              if (!paramn.getBool(localObject5))
              {
                if (i3 != 0) {
                  break label512;
                }
                this.b.c((a.c.e)localObject2, (a.c.d)localObject5);
              }
            }
            else {
              if (!bool) {
                break;
              }
            }
            ((a.c.m)localObject4).b();
          } while (((a.c.m)localObject4).a() != localObject3);
        }
      }
      Object localObject4 = this.b.a((a.c.e)localObject2);
      if (i3 == 0)
      {
        if (localObject4 != null)
        {
          this.b.a((a.c.e)localObject2, null);
          localObject5 = ((a.c.e)localObject2).b((a.c.d)localObject4);
          do
          {
            a.c.d locald = ((a.c.m)localObject5).a();
            if (this.b.a(locald) != 2) {
              break;
            }
            if (i3 == 0)
            {
              if (!paramn.getBool(locald)) {
                this.b.a((a.c.e)localObject2, locald);
              }
            }
            else
            {
              if (i3 != 0) {
                break label636;
              }
              if (!bool) {
                break;
              }
            }
            ((a.c.m)localObject5).b();
          } while (((a.c.m)localObject5).a() != localObject4);
        }
        ((w)localObject1).f();
      }
    } while (!bool);
    label283:
    label336:
    localObject1 = localq.w();
    label391:
    do
    {
      if (!((a.c.m)localObject1).e()) {
        break;
      }
      localObject2 = ((a.c.m)localObject1).a();
      if (i3 == 0)
      {
        if (paramn.getBool(localObject2)) {
          this.b.a((a.c.d)localObject2, 0);
        }
        ((a.c.m)localObject1).f();
      }
    } while (!bool);
    label512:
  }
  
  private void a(ab paramab, a.c.n paramn)
  {
    int i1 = e.i;
    boolean bool = e.h;
    if (i1 == 0)
    {
      if (!paramab.isEmpty()) {
        this.a.a(paramab);
      }
    }
    else
    {
      a.c.m localm = this.a.a().w();
      if (localm.e())
      {
        paramn.a(localm.a(), false);
        localm.f();
      }
      for (;;)
      {
        if ((i1 != 0) || (!bool))
        {
          if (!bool) {
            break;
          }
          if (i1 == 0) {
            this.a.e();
          }
        }
      }
    }
  }
  
  private void a(a.c.m paramm)
  {
    int i1 = e.i;
    boolean bool = e.h;
    Object localObject2;
    label125:
    label127:
    do
    {
      if (!paramm.e()) {
        break;
      }
      localObject1 = paramm.a();
      this.b.a((a.c.d)localObject1, 0);
      if (bool) {
        break label134;
      }
      localObject2 = this.a.m((a.c.d)localObject1);
      do
      {
        do
        {
          if (!((a.c.m)localObject2).e()) {
            break;
          }
          this.b.a(((a.c.m)localObject2).a(), 0);
          this.b.a(this.a.b(((a.c.m)localObject2).a()), 0);
          ((a.c.m)localObject2).f();
          if (i1 != 0) {
            break label127;
          }
          if (bool) {
            break label125;
          }
        } while (!bool);
      } while (i1 != 0);
      paramm.f();
    } while (!bool);
    label134:
    Object localObject1 = this.a.a().v();
    do
    {
      if (!((w)localObject1).e()) {
        break;
      }
      localObject2 = ((w)localObject1).d();
      a.c.d locald1 = this.b.a((a.c.e)localObject2);
      Object localObject3 = null;
      if (locald1 != null)
      {
        localObject4 = ((a.c.e)localObject2).b(locald1);
        do
        {
          localObject5 = ((a.c.m)localObject4).a();
          if (this.b.a((a.c.d)localObject5) == 2) {
            localObject3 = localObject5;
          }
          ((a.c.m)localObject4).b();
          if (i1 != 0) {
            break;
          }
        } while ((((a.c.m)localObject4).a() != locald1) && (localObject3 == null));
      }
      this.b.a((a.c.e)localObject2, localObject3);
      Object localObject4 = this.b.b((a.c.e)localObject2);
      Object localObject5 = null;
      if (localObject4 != null)
      {
        a.c.m localm = ((a.c.e)localObject2).b((a.c.d)localObject4);
        do
        {
          a.c.d locald2 = localm.a();
          if (this.b.a(locald2) == 1) {
            localObject5 = locald2;
          }
          localm.b();
          if (i1 != 0) {
            break;
          }
        } while ((localm.a() != localObject4) && (localObject5 == null));
      }
      this.b.c((a.c.e)localObject2, (a.c.d)localObject5);
      ((w)localObject1).f();
    } while (!bool);
  }
  
  public void b()
  {
    this.a.o();
    this.a.i();
  }
  
  protected void a(boolean paramBoolean1, boolean paramBoolean2)
  {
    int i1 = e.i;
    if (i1 == 0) {
      if (!this.u) {
        return;
      }
    }
    if (i1 == 0) {
      if (!this.a.h()) {
        throw new RuntimeException("Not Planar!");
      }
    }
    if (i1 == 0) {
      if (!this.a.j()) {
        throw new RuntimeException("Outer Face not set !");
      }
    }
    if (i1 == 0) {
      if (paramBoolean1) {
        k();
      }
    }
    if ((i1 != 0) || ((paramBoolean2) && (!this.b.d()))) {
      throw new RuntimeException("Not an st graph !");
    }
  }
  
  protected void k()
  {
    int i1 = e.i;
    boolean bool = e.h;
    a.c.m localm = this.a.a().w();
    do
    {
      if (!localm.e()) {
        break;
      }
      a.c.d locald = localm.a();
      if (i1 == 0)
      {
        if (this.b.a(locald) == 0) {
          throw new RuntimeException("Edge has no direction (" + locald + ") !");
        }
        localm.f();
      }
    } while (!bool);
  }
  
  private void l()
  {
    a.i.n.a(this, 0, "  result is planar? " + this.a.h());
    a.i.n.a(this, 0, "Outer face: " + this.a.c());
    a.i.n.a(this, 0, "**********************************");
    a.i.n.a(this, 0, "***** PLANAR EMBEDDING DONE! *****");
    a.i.n.a(this, 0, "**********************************\n");
  }
  
  private void m()
  {
    int i1 = e.i;
    a.i.n.a(this, 0, "***************************************");
    a.i.n.a(this, 0, "********   PLANAR EMBEDDING    ********");
    a.i.n.a(this, 0, "***************************************");
    a.i.n.a(this, 3, "\nSETTINGS:");
    a.i.n.a(this, 3, "  edge rerouting enabled    : " + this.k);
    if (i1 == 0) {
      if (this.l == -1)
      {
        a.i.n.a(this, 3, "  no reroute iterations bound");
        if (i1 != 0) {
          return;
        }
        if (!e.h) {
          break label115;
        }
      }
    }
    a.i.n.a(this, 3, "  reroute iterations        : " + this.l);
    label115:
    a.i.n.a(this, 3, "  allow randomization       : " + this.j + "\n");
  }
  
  private void n()
  {
    int i1 = e.i;
    boolean bool = e.h;
    a.i.n.a(0, "*** SHOWING EDGE DIRECTIONS ***");
    do
    {
      a.c.m localm = this.a.a().w();
      while (!bool)
      {
        if (!localm.e()) {
          break;
        }
        a.i.n.a(0, " Edge: " + localm.a() + " direction: " + this.b.a(localm.a()));
        localm.f();
      }
    } while (i1 != 0);
  }
  
  protected void o()
  {
    int i1 = e.i;
    boolean bool = e.h;
    a.i.n.a(0, "\n******************* DEBUG INFORMATION *******************");
    a.i.n.a(0, "SHOWING FACES");
    o localo = this.a.b();
    if (localo.e()) {}
    while (i1 != 0)
    {
      a.i.n.a(0, "  Face: " + localo.a());
      localo.f();
      if ((i1 == 0) && (bool)) {
        break label122;
      }
      if (!bool) {
        break;
      }
    }
    a.i.n.a(0, "  outer face: " + this.a.c());
    label122:
    w localw = this.a.a().v();
    a.i.n.a(0, "\nSHOWING CIRCULAR EDGE ORDER / FIRST IN AND FIRST OUT");
    label321:
    label323:
    label326:
    do
    {
      do
      {
        do
        {
          if (!localw.e()) {
            break label326;
          }
          a.c.e locale = localw.d();
          a.i.n.a(0, "  currentNode: " + locale);
          if (bool) {
            return;
          }
          a.c.m localm = locale.n();
          do
          {
            if (!localm.e()) {
              break;
            }
            a.i.n.a(0, "    outedge: " + localm.a());
            localm.f();
            if (i1 != 0) {
              break label323;
            }
            if (bool) {
              break label321;
            }
          } while (!bool);
          a.i.n.a(0, "  first in : " + this.b.a(locale));
          a.i.n.a(0, "  first out: " + this.b.b(locale));
        } while (i1 != 0);
        localw.f();
      } while (!bool);
      a.i.n.a(0, "EDGE DIRECTIONS");
      n();
    } while (i1 != 0);
    a.i.n.a(0, "**********************************************************");
  }
  
  static class a_
    extends t
  {
    private a.c.n b;
    
    public a_(a.c.n paramn)
    {
      this.b = paramn;
    }
    
    public int getInt(Object paramObject)
    {
      if (e.i == 0) {
        if (this.b.getBool(paramObject)) {
          return 1;
        }
      }
      return 10;
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.f.h.f.a.b

 * JD-Core Version:    0.7.0.1

 */